/**
 * @file
 * Created by  on 2016/4/1.
 */
const state = {
    // TODO: 放置初始状态
    modalShow: false,
    modalTitle: 'title',
    modalContent: 'content'
};
// 创建一个对象存储一系列我们接下来要写的 mutation 函数
const mutations = {
    setModalShow: (state, modalShow) => state.modalShow = modalShow,
    resetModal: (state, info) => {
        state.modalTitle = info.title;
        state.modalContent = info.content;
    }
};

const actions = {
    openModal({commit}, info) {
        commit('setModalShow', true);
        if (info) {
            commit('resetModal', info);
        }
    },
    closeModal({commit}) {
        commit('setModalShow', false);
    }
};

export default {
    state,
    mutations,
    actions
};



